package com.prime.tutorial.moviestore.service.auth;

import com.prime.tutorial.moviestore.domain.Users;
import com.prime.tutorial.moviestore.domain.UserActivity;
import org.springframework.transaction.annotation.Transactional;

/**
 * Provides login&logout and authentication services to users<br/>
 * Created by IntelliJ IDEA.<br/>
 * Date: 21 лют 2010<br/>
 * Time: 0:50:17 <br/>
 * @author iryna.masyuk
 */
public interface AuthService {
    /**
     * Returns User by login&password
     * @param login login string
     * @param password password string
     * @return User in case of successfull login, null otherwise
     */
   public Users login(String login, String password);

    /**
     * Creates UserActivity record, whih is used to track users
     * @param ua UserActivity object to persist
     */
   @Transactional
   public void createUserActivity(UserActivity ua);

    /**
     * Updates UserActivity record.
     * Usually is used in case of the logout
     * @param ua UserActivity object to update
     */
   @Transactional
   public void updateUserActivity(UserActivity ua); 
}
